package com.sofwin.controller.contents;

import com.sofwin.mapper.CLanduseMapper;
import com.sofwin.pojo.*;
import com.sofwin.service.contents.AssetsMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Project: ssm-parent
 * @Description: 公司主要资产控制层
 * @Author : abiao
 * @date Date : 2021年04月27日 上午 10:06
 */
@Controller
@RequestMapping("assets")
public class MainAssetsController {

    @Autowired
    private AssetsMainService assetsMainService;

    /**
    * @Author abiao
    * @Description  查询公司主要资产
    * @Date 2021/4/27 上午 10:22
    * @param cAssetsMain 公司主要资产pojo
    * @param model 数据
    * @return String 视图
    */
    @RequestMapping("data")
    public String data(CAssetsMain cAssetsMain, Model model){
        Integer assetsId = assetsMainService.selectAssetsIdByCompanyId(cAssetsMain);

        List<CLanduse> cLanduses = assetsMainService.selectLandUse(assetsId);
        List<CHouseOwner> cHouseOwners = assetsMainService.selectHouseOwner(assetsId);
        List<CConstruction> cConstructions = assetsMainService.selectConstruction(assetsId);
        List<CMainEquipment> cMainEquipments = assetsMainService.selectMainEquipment(assetsId);
        List<CMainvehicles> cMainvehicles = assetsMainService.selectMainvehicle(assetsId);
        model.addAttribute("landUse",cLanduses);
        model.addAttribute("houseOwner",cHouseOwners);
        model.addAttribute("Construction",cConstructions);
        model.addAttribute("mainEquipment",cMainEquipments);
        model.addAttribute("mainVehicles",cMainvehicles);
        return "c_information/contents/mainzc";
    }
}
